// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IRTC_BASE_OBJC_IRTCREMOTESTREAM_H_
#define IRTC_BASE_OBJC_IRTCREMOTESTREAM_H_

#import "IRTC/IRTCMediaFormat.h"
#import "IRTC/IRTCStream.h"
NS_ASSUME_NONNULL_BEGIN
@protocol IRTCRemoteStreamDelegate;

/// Asr info.<br>Asr信息。
IRTC_OBJC_EXPORT
@interface IRTCAsrInfo : NSObject
@property(nonatomic, strong) NSString* content;
@property(nonatomic, strong) NSString* id;
@property(nonatomic, strong) NSString* streamId;
@property(nonatomic, strong) NSString* type;
@end

/// Speaking status.<br>说话状态。
///
/// This enumeration defines speaking status of stream.
///< br>此枚举类型定义了媒体流说话的状态。
typedef NS_ENUM(NSInteger, IRTCSpeakingStatus) {
  IRTCSpeakingStart = 1,  ///< speaking start<br>开始说话
  IRTCSpeakingDone = 2,   ///< speaking done<br>结束说话
  IRTCSpeakingError = 3,  ///< speaking error<br>说话出错
  IRTCSpeakingUnknown = 4,
};

/// Speaking info.<br>Speaking信息。
IRTC_OBJC_EXPORT
@interface IRTCSpeakingInfo : NSObject
@property(nonatomic, strong) NSString* streamId;
@property(nonatomic, assign) IRTCSpeakingStatus status;
@property(nonatomic, strong) NSString* data;
@end

/// This class represents a remote stream.<br>这个类代表了远端媒体流。
IRTC_OBJC_EXPORT
@interface IRTCRemoteStream : IRTCStream

/**
  @brief Set a user-defined attribute map.<br>设置用户定义的属性映射集。
  @details Remote stream can only change local data， not effect other
  subscriber's data.
  <br>远端流只会设置自己本地的数据，不会影响其他订阅者的数据。
*/
- (void)setAttributes:(NSDictionary<NSString*, NSString*>*)attributes;

/**
  @brief Whether this Stream has an audio track.<br>当前媒体流是否有音频轨。
  @return Return true if it has an audio track; otherwise,
  false.<br>如果有音频轨返回true，否则false。
*/
- (BOOL)hasAudio;

/**
  @brief Whether this Stream has a video track.<br>当前媒体流是否有视频轨。
  @return Return true if it has a video track; otherwise,
  false.<br>如果有视频轨返回true，否则false。
*/
- (BOOL)hasVideo;

/**
  Get the stream owner's ID.
  If will be an empty string if a stream is generated by MCU
  server.<br>获取流的主人的ID。如果流是MCU服务器产生的，它将是空字符串。
*/
@property(nonatomic, strong, readonly) NSString* origin;

@property(nonatomic, strong, readonly) IRTCPublicationSettings* settings;
/// Original settings for publishing this stream.<br>发布这条流时的原始配置。
@property(nonatomic, strong, readonly)
    IRTCSubscriptionCapabilities* capabilities;
/// Capabilities remote endpoint provides for
/// subscription.<br>订阅流时远端可以选择的参数。
@property(nonatomic, weak, readwrite) id<IRTCRemoteStreamDelegate> delegate;
@end
IRTC_OBJC_EXPORT
@protocol IRTCRemoteStreamDelegate <NSObject>
/// Triggered when a stream is ended, or the stream is no longer available in
/// conference.<br>当一条媒体流结束或者不再在会议内有效时触发。
- (void)streamDidEnd:(IRTCRemoteStream*)stream;
/// Triggered when a stream is updated.<br>当一条媒体流更新时触发。
- (void)streamDidUpdate:(IRTCRemoteStream*)stream;
/// Triggered when a stream is updated.<br>当一条媒体流更新时触发。
- (void)streamDidUpdate:(IRTCRemoteStream*)stream
                 fields:(NSArray<NSNumber*>*)fields;
/// Triggered when stream is muted.<br>当一条媒体流音视频静默时触发。
- (void)streamDidMute:(IRTCRemoteStream*)stream trackKind:(IRTCTrackKind)kind;
/// Triggered when stream is unmuted.<br>当一条媒体流音视频取消静默时触发
- (void)streamDidUnmute:(IRTCRemoteStream*)stream trackKind:(IRTCTrackKind)kind;
/// Triggered when the asr callbecked.<br>当Asr的回调发生时触发。
- (void)streamDidAsr:(IRTCRemoteStream*)stream info:(IRTCAsrInfo*)info;
/// Triggered when the speaking callbecked.<br>当Speaking的回调发生时触发。
- (void)streamDidSpeaking:(IRTCRemoteStream*)stream
                     info:(IRTCSpeakingInfo*)info;
/// Triggered when the quality report
/// callbecked.<br>当连接质量报告的回调发生时触发。
- (void)streamDidQualityReport:(IRTCRemoteStream*)stream
                        report:(IRTCQualityReport*)report;
/// Triggered when remote stream connection state changed.
/// <br>当远程流连接状态变化时触发。
- (void)streamDidConnectionState:(IRTCRemoteStream*)stream
                           state:(IRTCConnectionState)state;
/// Triggered when the stream warn event occured in conference.
/// <br>当媒体流在会议模式中出现告警时触发。
- (void)streamDidWarn:(IRTCRemoteStream*)stream info:(NSString*)info;
@end
NS_ASSUME_NONNULL_END
#endif  // IRTC_BASE_OBJC_IRTCREMOTESTREAM_H_